<!DOCTYPE html>
<html>
    
    <head>
        <meta charset="utf-8">
        <title>
            X-admin v1.0
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="__PUBLIC__/admin/css/x-admin.css" media="all">
    </head>
    
    <body>
        <div class="x-body">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label for="L_email" class="layui-form-label">
                        <span class="x-red">*</span>手机
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="L_email" name="phone" required="" lay-verify="phone" disabled placeholder="手机号码" autocomplete="off" class="layui-input" value="{$laoshi.phone}">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>将会成为您唯一的登入名
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_username" class="layui-form-label">
                        <span class="x-red">*</span>昵称
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="L_username" name="username" required="" lay-verify="nikename" placeholder="李老师"autocomplete="off" class="layui-input" value="{$laoshi.name}">
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <?php if ($laoshi['sex'] == '男') { ?>
                                <input type="radio" name="sex" value="男" checked title="男">
                                <input type="radio" name="sex" value="女" title="女">
                            <?php }else { ?>
                                <input type="radio" name="sex" value="男"  title="男">
                                <input type="radio" name="sex" value="女" checked title="女">
                            <?php } ?>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_username" class="layui-form-label">
                        <span class="x-red">*</span>学历
                    </label>
                    <div class="layui-input-inline" style="width: 80px;">
                        <select name="xueli" id="" required lay-verify="required">
                            <option value="">{$laoshi.education}</option>
                            <option value="大专">大专</option>
                            <option value="本科">本科</option>
                            <option value="硕士">硕士</option>
                            <option value="博士">博士</option>
                        </select>
                    </div>
                    <div class="layui-inline" style="width: 160px;">
                        <input type="text" id="L_username" name="school" required lay-verify="required" placeholder="输入毕业学校"autocomplete="off" class="layui-input" value="{$laoshi.school}">
                    </div>
                    <div class="layui-inline" style="width: 160px;">
                        <input type="text" id="L_username" name="zhuanye" required lay-verify="required" placeholder="专业"autocomplete="off" class="layui-input" value="{$laoshi.major}">
                    </div>                    
                </div>
                <div class="layui-form-item">
                    <label for="L_username" class="layui-form-label">
                        <span class="x-red">*</span>城市
                    </label>
                    <div class="layui-input-inline">
                        <select name="city" id="" required lay-verify="required">
                                <option value="">{$laoshi.city}</option>
                            <?php foreach ($citys as $c) { ?>
                                <option value="{$c.city_name}">{$c.city_name}</option>
                            <?php } ?>
                        </select>
                    </div>                 
                </div>

                <div class="layui-form-item">
                    <label for="L_repass" class="layui-form-label">
                    </label>
                    <input type="hidden" name="id" value="{$laoshi.id}">
                    <button  class="layui-btn" lay-filter="save" lay-submit="">更新</button>
                </div>
            </form>
            <div style="width: 240px;height: 230px;float: left;border: 1px solid #b5b0b0;">
                <?php if (empty($laoshi['sfz_img'])) { ?>
                    <span style="color: red;font-size: 12px;">未上传身份证</span>
                <?php }else { ?>
                    <img src="__ROOT__{$laoshi.sfz_img}" alt="" style="width: 220px;height: 180px;padding: 5px 10px;">
                <?php } ?>
                &nbsp;&nbsp;身份证：
                <a class="layui-btn" onclick="member_show(' {$laoshi.sfz_name}','{:U('admin/laoshi/zheng_img',array('id'=>$laoshi['id'],'img'=>'sfz'))}','','407','400')" style="margin-top: 3px;">
                看大图</a>
            </div>
            <div style="width: 240px;height: 230px;float: left;margin: 0 15px;border: 1px solid #b5b0b0;">
                <?php if (empty($laoshi['jiaoshizheng_img'])) { ?>
                    <span style="color: red;font-size: 12px;">未上传教师证</span>
                <?php }else { ?>
                    <img src="__ROOT__{$laoshi.jiaoshizheng_img}" alt="" style="width: 220px;height: 180px;padding: 5px 10px;">
                <?php } ?>
                &nbsp;&nbsp;教师证：
                <a class="layui-btn" onclick="member_show(' {$laoshi.sfz_name}','{:U('admin/laoshi/zheng_img',array('id'=>$laoshi['id'],'img'=>'jsz'))}','','407','400')" style="margin-top: 3px;">
                看大图</a>
            </div>
            <div style="width: 230px;height: 230px;float: left;border: 1px solid #b5b0b0;">
                <?php if (empty($laoshi['qitazheng_img'])) { ?>
                    <span style="color: red;font-size: 12px;">未上传其它证</span>
                <?php }else { ?>
                    <img src="__ROOT__{$laoshi.qitazheng_img}" alt="" style="width: 220px;height: 180px;padding: 5px 10px;">
                <?php } ?>
                &nbsp;&nbsp;其它证：
                <a class="layui-btn" onclick="member_show(' {$laoshi.sfz_name}','{:U('admin/laoshi/zheng_img',array('id'=>$laoshi['id'],'img'=>'qt'))}','','407','400')" style="margin-top: 3px;">
                看大图</a>
            </div>
        </div>
        <script src="__PUBLIC__/admin/lib/layui/layui.js" charset="utf-8">
        </script>
        <script src="__PUBLIC__/admin/js/x-layui.js" charset="utf-8">
        </script>
        <script>
            layui.use(['form','layer'], function(){
                $ = layui.jquery;
              var form = layui.form()
              ,layer = layui.layer;
            
              //自定义验证规则
              // form.verify({
              //   nikename: function(value){
              //     if(value.length < 3){
              //       return '昵称至少得3个字符啊';
              //     }
              //   }
              //   ,pass: [/(.+){6,12}$/, '密码必须6到12位']
              //   ,repass: function(value){
              //       if($('#L_pass').val()!=$('#L_repass').val()){
              //           return '两次密码不一致';
              //       }
              //   }
              // });

              //监听提交
              form.on('submit(save)', function(data){
                //console.log(data);
                //发异步，把数据提交给php
                $.ajax({
                    url: "{:U('admin/laoshi/edit')}",//请求地址
                    type: "post",//请求方式
                    dataType: "json",//返回数据类型
                    data: data.field,//发送的参数
                    })
                    .done(function(response) {
                          if(response.error==0){
                             layer.msg(response.info ,{icon:5});

                          }else{
                            layer.alert(response.info, {icon: 6},function () {
                                // 获得frame索引
                                var index = parent.layer.getFrameIndex(window.name);
                                //关闭当前frame
                                parent.layer.close(index);
                            });
                          }
                      })
                    .fail(function() {
                        alert("ajxs交互失败");
                    })  

                return false;
              });
            });

            /*照片证-查看*/
            function member_show(title,url,id,w,h){
                x_admin_show(title,url,w,h);
            }
        </script>
    </body>

</html>